﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace MINERP.PhotoRindGrid
{
    public partial class UCGrid : UserControl
    {
        public UCGrid()
        {
            InitializeComponent();
        }


        //private string  _gridName;
        private int      _orderId;
        //private string  _orderName;
        private int    _gridId;
        public int ShopId { get; set; }
        private string _subareaName;
        private string _shopName;
        private string _ctmName;
        private DateTime _enterTime;

        public DateTime CompleteTime{ get; set;}

        public DateTime FirstEnterTime
        {
            get { return _enterTime; }
            set { _enterTime = value; }
        }

        
        public string CtmName
        {
            get { return _ctmName; }
            set { _ctmName = value; }
        }


        public string ShopName
        {
            get { return _shopName; }
            set { _shopName = value; }
        }

        public string SubAreaName
        {
            get { return _subareaName; }
            set { _subareaName = value; }
        }

        public int GridId
        {
            get { return _gridId; }
            set { _gridId = value; }
        }

        public string OrderBarCode
        {
            get { return this.labProductName.Text; }
            set { labProductName.Text = value; }
        }

        public string OrderName
        {
            get { return this.labOrderName.Text; }
            set { this.labOrderName.Text = value; }
        }

        public int OrderId
        {
            get { return _orderId; }
            set { _orderId = value; }
        }

        public string GridName
        {
            get { return this.labGridName.Text; }
            set { this.labGridName.Text = value; }
        }

        public  string  Cout
        {
            get { return this.labCout.Text.Split('/')[1];}
            set { this.labCout.Text = @"/"+value; }
        }
        public string Curr
        {
            get { return this.labCurr.Text; }
            set { this.labCurr.Text = value; }
        }
        public void SetEvent(Control control)
        {
            control.Click += new EventHandler(UCGrid_Click);
            control.DoubleClick += new EventHandler(UCGrid_DoubleClick);
            ControlCollection ccl = control.Controls;
            foreach (Control collection in ccl)
            {
                SetEvent(collection);
            }

        }
        public delegate void PostClicks(UCGrid grid);

        public event PostClicks UCGridDoubleClick;
        public event PostClicks UCGridClick;
        private void UCGrid_Click(object sender, EventArgs e)
        {
            UCGridClick(this);
        }

        private void UCGrid_DoubleClick(object sender, EventArgs e)
        {
            UCGridDoubleClick(this);
        }

        private void UCGrid_Load(object sender, EventArgs e)
        {
            //SetEvent(this);
        }

        private void labProductName_Click(object sender, EventArgs e)
        {
            SetEvent(this);
        }

        private void labGridName_Click(object sender, EventArgs e)
        {
            SetEvent(this);
        }

        private void labShopName_Click(object sender, EventArgs e)
        {
            SetEvent(this);
        }

        private void labOrderName_Click(object sender, EventArgs e)
        {
            SetEvent(this);
        }

        private void labCout_Click(object sender, EventArgs e)
        {
            SetEvent(this);
        }

        private void labCurr_Click(object sender, EventArgs e)
        {
            SetEvent(this);
        }

        private void labCurr_DoubleClick(object sender, EventArgs e)
        {
            SetEvent(this);
        }

        private void labCout_DoubleClick(object sender, EventArgs e)
        {
            SetEvent(this);
        }
        



    }
}
